#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e5 + 5;
const int M = 1e9 + 7;

int T, n;
ll d[N], s[N];

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);

    cin >> T;
    while (T--)
    {
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> d[i];
        sort(d + 1, d + n + 1);
        for (int i = 1; i <= n; i++)
            s[i] = s[i - 1] + d[i];

        ll res = d[n];
        for (int i=1; i<=n-1; i++)
            res+=(n-i+1)*d[i]-(s[n]-s[i-1]);
        cout << res << endl;
    }
    return 0;
}
